import { textureRouter } from "../components/texture";
import { getRouterInfo } from "../util/Util";

const ReactMore = [
  {
    path: "",
    name: "rect_more1",
    meta: { type: 0, title: "DrawArrays" },
    component: () => import("../components/BaseMoreReact.vue"),
  },
  {
    path: "/react_more2",
    name: "rect_func",
    meta: { type: 0, title: "DrawElements" },
    component: () => import("../components/BaseMoreReact.vue"),
  },
];

const TranRoute = [
  {
    path: "",
    name: "tran-py1",
    meta: { type: 0, title: "平移-坐标点向量" },
    component: () => import("../components/BaseRectTranform.vue"),
  },
  {
    path: "/tran-py2",
    name: "convert-tran",
    meta: { type: 0, title: "平移2-x,y值" },
    component: () => import("../components/BaseRectTranform2.vue"),
  },{
    path: "/tran-py3",
    name: "convert-tran3",
    meta: { type: 0, title: "平移3矩阵" },
    component: () => import("../components/BaseRectTranform3.vue"),
  },
  {
    path: "/tran-rotate1",
    name: "tran-rotate1",
    meta: { type: 0, title: "旋转-Z" },
    component: () => import("../components/BaseRectRotate.vue"),
  },
  {
    path: "/tran-rotate2",
    name: "tran-rotate2",
    meta: { type: 0, title: "旋转-轴" },
    component: () => import("../components/BaseRectRotate2.vue"),
  },
  {
    path: "/tran-scale",
    name: "tran-scale",
    meta: { type: 0, title: "缩放" },
    component: () => import("../components/BaseRectScale.vue"),
  },
];

const BaseRouter = [
  {
    path: "",
    name: "part1",
    meta: { type: 0, title: "绘制点" },
    component: () => import("../components/BaseRenderPoint.vue"),
  },
  {
    path: "/line",
    name: "line",
    meta: { type: 0, title: "绘制线" },
    component: () => import("../components/BaseRenderLine.vue"),
  },
  {
    path: "/rect_more",
    name: "rect_more",
    meta: { type: 0, title: "绘制多边形" },
    component: () => import("../components/ContextList.vue"),
    props: {
      lists: [getRouterInfo(ReactMore)],
      titles: ["调用方式"],
    },
    children: ReactMore,
  },
  {
    path: "/tran",
    name: "tran",
    meta: { type: 0, title: "平移-缩放-旋转" },
    component: () => import("../components/ContextList.vue"),
    props: {
      lists: [getRouterInfo(TranRoute)],
      titles: ["形变"],
    },
    children: TranRoute,
  },
  {
    path: "/renderImage",
    name: "renderImage",
    meta: { type: 0, title: "绘制图片" },
    component: () => import("../components/BaseRenderImage.vue"),
  },
  {
    path: "/game",
    name: "game",
    meta: { type: 0, title: "贪吃蛇" },
    component: () => import("../components/BaseRenderGame.vue"),
  },
  {
    path: "/texture",
    name: "texture",
    meta: { type: 0, title: "纹理" },
    component: () => import("../components/ContextList.vue"),
    props: {
      lists: [getRouterInfo(textureRouter)],
      titles: ["纹理"],
    },
    children: textureRouter,
  },
];

const BaseList = getRouterInfo(BaseRouter);

export { BaseRouter, BaseList };
